package com.cxlin.cwanandroid.model.repository

import com.cxlin.base.model.api.BaseRepository
import com.cxlin.cwanandroid.model.api.WanRetrofitClient
import com.cxlin.cwanandroid.model.bean.SystemParent
import com.cxlin.base.model.api.Result
import com.cxlin.cwanandroid.model.bean.ArticleList

/**
 *
 * @Author: chenxunlin
 * @Date: 2024/4/30 9:35
 */
class ProjectRepository : BaseRepository(){

    suspend fun getBlog():Result<List<SystemParent>>{
        return safeApiCall(
            call = {executeResponse(WanRetrofitClient.service.getBlogType())},
            errorMessage = "网络错误"
        )
    }

    suspend fun getLastedProject(page:Int):Result<ArticleList>{
        return safeApiCall(
            call = {executeResponse(WanRetrofitClient.service.getLastedProject(page))},
            errorMessage = "网络错误"
        )
    }

    suspend fun getProjectType():Result<List<SystemParent>>{
        return safeApiCall(
            call = {executeResponse(WanRetrofitClient.service.getProjectType())},
            errorMessage = "网络错误"
        )
    }

    suspend fun getProjectTypeDetailList(page: Int, cid: Int):Result<ArticleList>{
        return safeApiCall(
            call = {executeResponse(WanRetrofitClient.service.getProjectTypeDetail(page, cid))},
            errorMessage = "网络错误"
        )
    }
}